package com.CampaignManager.server;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Job {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	public Key getId() {
		return this.id;
	}
	public String safeKey() {
		return KeyFactory.keyToString(this.id);
	}
	
	@Persistent
	private Player player;	
	public Player getPlayer() {
		return this.player;
	}
	
	@Persistent
	private String jobType;
	@Persistent
	private String status;
	@Persistent
	private String email;
	@Persistent
	private String jobFor;
	@Persistent
	private String destination;
	@Persistent
	private Long reward;
	@Persistent
	private Date taken;
	@Persistent
	private String storyMessageID;
	@Persistent
	private String storySubject;
	
	public String getStorySubject() {
		return storySubject;
	}
	public void setStorySubject(String storySubject) {
		this.storySubject = storySubject;
	}
	public String getStoryMessageID() {
		return storyMessageID;
	}
	public void setStoryMessageID(String storyMessageID) {
		this.storyMessageID = storyMessageID;
	}
	public String getJobFor() {
		return jobFor;
	}
	public void setJobFor(String jobFor) {
		this.jobFor = jobFor;
	}
	public Date getTaken() {
		return taken;
	}
	public void setTaken(Date taken) {
		this.taken = taken;
	}
	public String getDestination() {
		return destination;
	}
	public void setDestination(String destination) {
		this.destination = destination;
	}
	public Long getReward() {
		return reward;
	}
	public void setReward(Long reward) {
		this.reward = reward;
	}
	public String getEmail() {
		if (email == null) email = player.getEmail();
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getJobType() {
		return jobType;
	}
	public void setJobType(String jobType) {
		this.jobType = jobType;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
}
